//NC26226
import java.util.*;

public class Main{
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        in.nextLine();
        String str = in.nextLine();
        long[][] dp = new long[3][n];
        int a = 0;
        int b = 0;
        if (str.charAt(0) == 's') {
            dp[0][0] = 1;
        }
        for (int i = 1; i < n; i++) {
            char c = str.charAt(i);
            
            if (c == 's') {
                dp[0][i] = dp[0][i-1]+1;
            } else {
                dp[0][i] = dp[0][i-1];
            }
            
            if (c == 'h') {
                dp[1][i] = dp[0][i-1] + dp[1][i-1];
            } else {
                dp[1][i] = dp[1][i-1];
            }
            
            if (c == 'y') {
                dp[2][i] = dp[1][i-1] + dp[2][i-1];
            } else {
                dp[2][i] = dp[2][i-1];
            }
        }
        System.out.println(dp[2][n-1]);
    }
}
//DP13
import java.util.*;

// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        while (in.hasNextInt()) { // 注意 while 处理多个 case
            int n = in.nextInt();
            int m = in.nextInt();
            int x = in.nextInt();
            int y = in.nextInt();
            if (x == 0 && y == 0) {
                System.out.println(0);
                continue;
            }
            if (x == n && y == m) {
                System.out.println(0);
                continue;
            }
            long[][] dp = new long[n + 1][m + 1];
            for (int i = 0; i < n + 1; i++) {
                if ((i == x && 0 == y) || (i != x && 0 != y &&
                                           Math.abs(i - x) + Math.abs(0 - y) == 3)) {
                    break;
                } else {
                    dp[i][0] = 1;
                }
            }


            for (int j = 0; j < m + 1; j++) {
                if ((0 == x && j == y) || (0 != x && j != y &&
                                           Math.abs(0 - x) + Math.abs(j - y) == 3)) {
                    break;
                } else {
                    dp[0][j] = 1;
                }
            }

            for (int i = 1; i < n + 1; i++) {
                for (int j = 1; j < m + 1; j++) {
                    if ((i == x && j == y) || (i != x && j != y &&
                                               Math.abs(i - x) + Math.abs(j - y) == 3)) {
                        dp[i][j] = 0;
                    } else {
                        dp[i][j] = dp[i - 1][j] + dp[i][j - 1];
                    }
                }
            }
            System.out.println(dp[n][m]);
        }
    }
}

class Solution {
    public int triangleNumber(int[] nums) {
        Arrays.sort(nums);
        System.out.println(Arrays.toString(nums));
        int r = 0;
        int l = 0;
        int count = 0;
        for (int i = nums.length-1; i >= 0; i--) {
            l = 0;
            r = i-1;
            while (l < r) {
                if (nums[l] + nums[r] > nums[i]) {
                    count += r-l;
                    r--;
                }else {
                    l++;
                }
            }
        }
        return count;
    }
}